package com.echo.aichat.oss;

import io.qifan.infrastructure.oss.service.OSSService;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("oss")
public class OSSController {

    // 指定注入 tencentOSSService
    private final OSSService ossService;

    public OSSController(@Qualifier("tencentOSSService") OSSService ossService) {
        this.ossService = ossService;
    }

    @PostMapping("upload")
    public String upload(@RequestParam MultipartFile file) {
        return ossService.upload(file);
    }
}
